package com.dp.vo;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Embeddable
public class NewsSnAreaPK implements Serializable {
		@Basic(optional = false)
	    @Column(name = "sn")
	    private String sn;
	    @Basic(optional = false)
	    @JoinColumn(name = "areaname", referencedColumnName = "areaid")   
	    @ManyToOne
	    private TAreainfo areainfo;		
	    
	    public NewsSnAreaPK(){
	    }
	    public NewsSnAreaPK(String sn,Integer areaid){
	    	this.sn=sn;
	    	this.areainfo=new TAreainfo(areaid);
	    }
		
		public String getSn() {
			return sn;
		}
		public void setSn(String sn) {
			this.sn = sn;
		}
		
		public TAreainfo getAreainfo() {
			return areainfo;
		}
		public void setAreainfo(TAreainfo areainfo) {
			this.areainfo = areainfo;
		}
		@Override
	    public int hashCode() {
	        int hash = 0;
	        hash += (sn != null ? sn.hashCode() : 0);
	        hash += (areainfo != null ? areainfo.hashCode() : 0);
	        return hash;
	    }

	    @Override
	    public boolean equals(Object object) {
	        if (!(object instanceof NewsSnAreaPK)) {
	            return false;
	        }
	        NewsSnAreaPK other = (NewsSnAreaPK) object;
	        if ((this.sn == null && other.sn != null) || (this.sn != null && !this.sn.equals(other.sn))) {
	            return false;
	        }
	        if ((this.areainfo == null && other.areainfo != null) || (this.areainfo != null && !this.areainfo.equals(other.areainfo))) {
	            return false;
	        }
	        return true;
	    }

	    @Override
	    public String toString() {
	        return "com.dp.vo.NewsSnArea[sn=" + sn + ", areainfo=" + areainfo + "]";
	    }
	    
}
